home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / amiga / execseg.a < prev    next >
Text File  |  1994-02-01  |  757b  |  33 lines

  1.  
  2.         ;
  3.         ;   _ExecSeg(seg, arg, arglen, stack)
  4.         ;
  5.         ;   (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  6.  
  7.         section text,code
  8.  
  9.         xdef    __ExecSeg
  10.  
  11. __ExecSeg    move.l    4(sp),D1            ; segment
  12.         move.l    8(sp),A0            ; arg
  13.         move.l    12(sp),D0           ; arglen
  14.         move.l    16(sp),A1           ; stack ptr
  15.  
  16.         movem.l D2-D7/A2-A6,-(sp)   ; save regs
  17.         move.l    A7,A2            ; old stack ptr
  18.         move.l    A1,A7            ; new stack ptr
  19.         move.l    A2,-(sp)            ; save old stack ptr
  20.  
  21.         asl.l    #2,D1            ; bptr to aptr
  22.         addq.l    #4,D1            ; skip segment hdr
  23.         move.l    D1,A2
  24.         jsr    (A2)                ; call program
  25.  
  26.                         ; return value in D0
  27.         move.l    (sp)+,A7            ; old stack
  28.         movem.l (sp)+,D2-D7/A2-A6   ; restore registers
  29.         rts                ; return
  30.  
  31.         END
  32.  
  33.